import { http } from "@/utils/http";
import { baseUrlApi } from "@/api/utils";
import { message } from "@/utils/message";

type ResultCreate = {
  code: number;
  msg: string;
};
/** 上传文件 */
export const uploadFileApi = (data?: object) => {
  return http.request<ResultCreate>("post", baseUrlApi + "/uploadFile/upload", {
    data
  },{
    headers: {
      'Content-Type': "multipart/form-data"
    }

  }).catch(error => {
		message(error.response.data.msg ?? "操作失败,请联系管理员", {
			type: "error"
		});
	});
};
